package cn.liontalk.PrototypePattern.pattern1;

/**
 *
 * 原型实例指定创建对象的种类，并且通过拷贝这些原型创建新的对象。
 */
public class Test {

//    public static void main(String[] args) {
//        Resume resume1 = new Resume();
//        resume1.setName("小郭");
//        resume1.setPosition("一代大侠");
//        resume1.setSalary(1000);
//        System.out.println(resume1);
//
//        System.out.println("=========================================");
//
//        Resume resume2 = new Resume();
//        resume2.setName("小郭");
//        resume2.setPosition("一代大侠");
//        resume2.setSalary(1200);
//        System.out.println(resume2);
//    }


    public static void main(String[] args) throws CloneNotSupportedException {
        int num = 5;
        ResumeClone resumeClone = new ResumeClone();
        while (num > 0){
            ResumeClone resume1 = resumeClone.clone();
            int salary = (int)(1000 + Math.random() * (2000 - 1000 + 1));
            resume1.setName("小郭");
            resume1.setPosition("一代大侠");
            resume1.setSalary(salary);
            System.out.println(resume1.toString());
            num --;
        }
    }
}
